package Common
{
	
	import Base.Loader.TextureLoader;
	
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Loader;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.IOErrorEvent;
	import flash.events.ProgressEvent;
	import flash.events.SecurityErrorEvent;
	import flash.net.URLRequest;
	
	public class UITextureLoader extends Sprite
	{
		public var urlRequest:URLRequest = null;
		public var loader:Loader = null;
		public var bitmap:Bitmap = null;
		public var fun:Function = null;
		
		
		public function UITextureLoader()
		{
			bitmap = new Bitmap();
			addChild( bitmap );
			
			urlRequest = new URLRequest();
		}
		
		
		public function clear():void
		{
			bitmap.bitmapData = null;
		}
		
		
		public function loadTexture( p:String , f:Function = null , useLoading:Boolean = false ):void
		{
			clear();
			
			TextureResManager.instance.load( p , onLoad1 , useLoading );
			fun = f;
		}
		
		
		public function onLoad1( bd:BitmapData ):void
		{
			bitmap.bitmapData = bd;
			
			if ( fun != null )
			{
				fun();
			}
		}
			
	}
}

